package com.example.springaidemo.controller.case5;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.stereotype.Component;

/**
 * tools工具
 *
 * @author stone
 * @date 2025/7/4 10:42
 */
@Component
@Slf4j
public class OrderTools {

    /**
     * 比如在美团上，退订、取消订单
     */
    @Tool(description = "退订、取消订单")
    public String cancelOrder(@ToolParam(description = "订单号") String orderNum,
                              @ToolParam(description = "账号") String userAccount) {

        log.info("订单号：{}，用户账号：{}", orderNum, userAccount);

        // 执行业务逻辑
        log.info("处理数据库...");

        return "操作成功";
    }
}
